module.exports = {
  stories: ['../src/**/*.stories.tsx'],
  addons: [
    '@storybook/preset-create-react-app',
    '@storybook/addon-actions',
    '@storybook/addon-links',
  ],
  webpackFinal: config => {
    config.module.rules.forEach(item => {
      //react-docgen-typescript-loader
      if (`${item.test}` === `${/\.tsx?$/}`) {
        item.use[0].options = {
          shouldExtractLiteralValuesFromEnum: true,
          savePropValueAsString: true,
          propFilter: prop => {
            if (prop.parent) {
              return !prop.parent.fileName.includes('node_modules');
            }

            return true;
          },
        };
      }
    });
    return config;
  },
};
